package in.co.codedoc.util;

import java.util.regex.Pattern;

public class StringUtil
{
	public static String StripQuotesAndEscapes(String text)
	{
		char fc = text.charAt(0);
		char lc = text.charAt(text.length()-1);
		
		if(fc == lc && (lc == '"' || lc == '\''))
		{
			text = text.substring(1,text.length()-1);
		}
		
		text = escapedCharPatter.matcher(text).replaceAll("$1");
		
		return text; 
	}
	
	private static final Pattern escapedCharPatter
		= Pattern.compile("\\\\(.)");
}
